<template>
  <template v-for="(item, index) in menuMap" :key="index">
    <el-sub-menu v-if="item.children" :index="cusKey + '-' + index">
      <template #title>
        <i v-if="item.icon" :class="item.icon"></i>
        <span>{{ item.text }}</span>
      </template>
      <CreateMenu v-bind:menuMap="item.children" v-bind:cusKey="cusKey + '-' + index"> </CreateMenu>
    </el-sub-menu>
    <el-menu-item v-else :index="item.path">
      <i v-if="item.icon" :class="item.icon"></i>
      <template #title>{{ item.text }}</template>
    </el-menu-item>
  </template>
</template>
<script>
export default {
  name: "CreateMenu",
  props: {
    menuMap: {
      Type: Array,
      require: true,
    },
    cusKey: {
      Type: String,
      default: "1",
    },
  },
};
</script>
